<template>
  <work-template @closeSelectedTag="closeSelectedTag" v-loading="loading" :flowId="flowId" :butShow="false">
    <div slot="form" class="container-div">
      <!--主订单-->
      <mainOrder v-model="ruleForm"/>
      <!--退保台数-->
      <cancellationNumber v-model="ruleForm" state="readonly"/>
    </div>
  </work-template>
</template>

<script>
import * as apis from "@/api/deliveryVehicle";

export default {
  name: 'DeliveryVehicleDetails',
  components: {
    //主订单
    mainOrder: () => import('./components/mainOrder.vue'),
    //退保台数
    cancellationNumber: () => import('./components/cancellationNumber.vue'),
  },
  computed: {
    flowId() {
      return this.$route.query.flowId
    }
  },
  watch: {},
  data() {
    return {
      ruleForm: {},
      loading: false
    };
  },
  created() {
    if (this.$route.query.id) {
      this.handleDetails(this.$route.query.id)
    }
  },
  mounted() {
  },
  methods: {
    async handleDetails(id) {
      this.loading = true
      try {
        let res = await apis?.unpreparedCarDeposit(id)
        this.ruleForm = res.data
      } catch (e) {
        console.error(e)
      } finally {
        this.loading = false
      }
    },

    closeSelectedTag() {
      this.$tab.closePage().then(({visitedViews}) => {
        this.$router.push({
          path: "/vehicleOrder/orderManagement/DeliveryVehicleList",
        });
      });
    }
  },
};
</script>

<style lang="scss" scoped>
@import "@/styles/cwgd/container.scss";
</style>


